<include file="nav:headr"/>
<div class="container">
    <div class="row">
        <div style="height: 30px"></div>
        <div class="col-md-2">
            <include file="Content:sider"/>
        </div>
        <div class="col-md-10">
            <div class="page-header">
                <h4>{$page_title}</h4>
            </div>
            <div class="btn-group" role="group" aria-label="...">
                <a  href="{:U('Article/index')}" type="button" class="btn btn-default">بارلىق خەۋەرلەر</a>
                <a href="{:U('Article/add')}" type="button" class="btn btn-default">يېڭىدىن قوشۇش</a>
            </div>
            <br><br>
            <table class="table table-bordered">
                <thead>
                <tr class="active">
                    <td width="30">ID</td>
                    <td width="50"> مۇقاۋا</td>
                    <td>خەۋەر تېمىسى</td>
                    <td>تۈرى </td>
                    <td>يوللىغۇچى </td>
                    <td width="130">يوللانغان ۋاقتى </td>
                    <td width="55">ھالىتى</td>
                    <td>مەشغۇلات</td>
                </tr>
                </thead>
                <tbody>
                <foreach name="sql" item="s">
                    <tr>
                        <td>{$s['aid']}</td>
                        <td><img style="width: 40px;height: 20px" src="__UPLOADs__/{$s['thumb']}" /></td>
                        <td>{$s['title']}</td>
                        <td>{$s['cname']}</td>
                        <td>{$s['author']} </td>
                        <td style="direction: ltr">{$s['addtime'] | date="Y-m-d H:i",###} </td>
                        <td>
                            <if condition="$s['status']">
                                <span class="label label-success">ئوچۇق</span>
                                <else/>
                                <span class="label label-danger">تاقاق</span>
                            </if>
                        </td>
                        <td>
                            <a href="{:U('Article/edit',array('aid'=>$s['aid']))}" class="btn-default">تەھرىرلەش</a>|
                            <a style="color: red;" href="javascript:deArticle({$s['aid']})">ئۆچۈرۈش</a>

                        </td>
                    </tr>
                </foreach>
                </tbody>
            </table>
             {$page} //分页
        </div>
    </div>
</div>
<script type="text/javascript">
    //删除提示框
    function deArticle(aid) {
        //询问框
        layer.confirm('راستىنلا ئۆچۈرەمسىز？', {
            btn: ['ھەئە','ياق'] //按钮
        }, function(){
            $.ajax({
                'url':"{:U('Article/delete')}",
                'type':'POST',
                'dataType':'json',
                'data':{'aid':aid},
                success:function (phpRetrnData) {
                    if(phpRetrnData.status){
                        layer.msg(phpRetrnData.massage,{'icon':6},function () {
                            window.location=location;
                        })
                    }else {
                        layer.msg(phpRetrnData.massage,{'icon':5});
                    }
                }
            })
        });
    }
</script>

<include file="nav:footer" />